def binarySearch(nums, target):
    length=len(nums)
    left=0
    right=length-1
    while left<=right:
        mid=(left+right)//2
        if nums[mid]==target:
            return mid
        elif nums[mid]<target:
            #如target=70,在1-100之间查询，mid=50，将left增大，right不变
            left=mid+1
        else:
            #mid>target,left不变，减小right
            right=mid-1
    return None

list=[1,3,5,7,9]
print(binarySearch(list,3))
print(binarySearch(list,10))



